package com.mushiengine.core {
import com.mushiengine.collection.HashMap;
import com.mushiengine.collection.IMap;

import flash.utils.describeType;

import mx.core.IMXMLObject;

import nl.demonsters.debugger.MonsterDebugger;

public class BeanDefinitionLoader implements IMXMLObject, IBeanDefinitionLoader{
    public function BeanDefinitionLoader() {
    }


    public function getDescriptions():IMap {
        var accessors:XMLList = XMLList(describeType(this).accessor.(@access == "readwrite"));

        MonsterDebugger.trace(this, accessors.toXMLString());

        return generateAccessorMap(accessors);
    }

    private function generateAccessorMap(accessors:XMLList):IMap {
        var beanDescriptions:IMap = new HashMap();

        for each(var xml:XML in accessors) {
            beanDescriptions.put(xml.@name.toString(), xml.@type.toString())
        }

        return beanDescriptions;
    }

    public function initialized(document:Object, id:String):void {

    }
}
}